﻿<Window x:Class="TestWpfC.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
        Title="MainWindow"
        Width="691"
        Height="634">
    <Window.Resources>
        <ControlTemplate x:Key="TemplateEditor"
                         x:Name="TemplateEditor"
                         TargetType="avalonEdit:TextEditor">
            <ScrollViewer Name="PART_ScrollViewer"
                          HorizontalContentAlignment="Left"
                          VerticalContentAlignment="Top"
                          Background="{TemplateBinding Control.Background}"
                          BorderBrush="{TemplateBinding Control.BorderBrush}"
                          BorderThickness="{TemplateBinding Control.BorderThickness}"
                          CanContentScroll="True"
                          Content="{Binding Path=TextArea,
                                            RelativeSource={RelativeSource TemplatedParent}}"
                          Focusable="False"
                          HorizontalScrollBarVisibility="Hidden"
                          Padding="{TemplateBinding Control.Padding}"
                          VerticalScrollBarVisibility="Hidden" />
            <ControlTemplate.Triggers>
                <Trigger Property="avalonEdit:TextEditor.WordWrap" Value="True">
                    <Setter TargetName="PART_ScrollViewer" Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="84" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <DockPanel Grid.Column="0">
            <Button Click="Button_Click" DockPanel.Dock="Top">Config</Button>
            <Button Click="Button_Click_1" DockPanel.Dock="Top">Connect</Button>
            <Button Click="Button_Click_2" DockPanel.Dock="Top">Projekt</Button>
            <Label Name="blockName"
                   HorizontalContentAlignment="Center"
                   DockPanel.Dock="Top">
                FCxx
            </Label>
            <Button Name="Upload"
                    Click="Upload_Click"
                    DockPanel.Dock="Top"
                    IsEnabled="False">
                Upload
            </Button>
            <Button Name="Optimize"
                    Click="Optimize_Click"
                    DockPanel.Dock="Top"
                    IsEnabled="False">
                OptimizeAWL
            </Button>
            <Button Name="Diag"
                    Click="Diag_Click"
                    DockPanel.Dock="Top"
                    IsEnabled="False">
                Diag
            </Button>
            <TextBox Name="startRow"
                     Height="25"
                     HorizontalContentAlignment="Center"
                     VerticalContentAlignment="Center"
                     DockPanel.Dock="Top"
                     ToolTip="Start Byte Adress of the Diag.">
                0
            </TextBox>
            <CheckBox Name="stw"
                      DockPanel.Dock="Top"
                      IsChecked="True">
                STW
            </CheckBox>
            <CheckBox Name="akku1" DockPanel.Dock="Top">Akku1</CheckBox>
            <CheckBox Name="akku2" DockPanel.Dock="Top">Akku2</CheckBox>
            <CheckBox Name="ar1" DockPanel.Dock="Top">AR1</CheckBox>
            <CheckBox Name="ar2" DockPanel.Dock="Top">AR2</CheckBox>
            <CheckBox Name="db" DockPanel.Dock="Top">DB</CheckBox>
            <ListBox Name="BlockList"
                     HorizontalAlignment="Stretch"
                     VerticalAlignment="Stretch"
                     MouseDoubleClick="BlockList_MouseDoubleClick"
                     SelectionChanged="BlockList_SelectionChanged" />

        </DockPanel>
        <DockPanel Grid.Column="1">
            <DockPanel Name="toppanel"
                       Height="160"
                       VerticalAlignment="Stretch"
                       DockPanel.Dock="Top">
                <TreeView Name="myTree"
                          Width="180"
                          DockPanel.Dock="Left"
                          ItemsSource="{Binding}"
                          SelectedItemChanged="myTree_SelectedItemChanged">
                    <TreeView.ItemTemplate>
                        <HierarchicalDataTemplate ItemsSource="{Binding Children}">
                            <TextBlock Text="{Binding Name}" />
                        </HierarchicalDataTemplate>
                    </TreeView.ItemTemplate>
                </TreeView>
                <DataGrid Name="myDGrid"
                          AutoGenerateColumns="False"
                          DockPanel.Dock="Right"
                          ItemsSource="{Binding Children}"
                          SelectionChanged="myDGrid_SelectionChanged">
                    <DataGrid.Columns>
                        <!--
                            <DataGridTextColumn Header="ID" Width="SizeToCells"
                            Binding="{Binding Id}"
                            CanUserSort="False"
                            IsReadOnly="True"/>
                            <DataGridTextColumn Header="Type"
                            Binding="{Binding Date, StringFormat=d}"
                            CanUserSort="False" />
                        -->
                        <DataGridTextColumn MinWidth="30"
                                            Binding="{Binding IsArray}"
                                            CanUserSort="False"
                                            Header="Array" />
                        <DataGridTextColumn MinWidth="30"
                                            Binding="{Binding ArrayStart}"
                                            CanUserSort="False"
                                            Header="ArrSt" />
                        <DataGridTextColumn MinWidth="30"
                                            Binding="{Binding ArrayStop}"
                                            CanUserSort="False"
                                            Header="ArrStp" />
                        <DataGridTextColumn MinWidth="100"
                                            Binding="{Binding Name}"
                                            CanUserSort="False"
                                            Header="Name" />
                        <DataGridTextColumn MinWidth="80"
                                            Binding="{Binding DataType}"
                                            CanUserSort="False"
                                            Header="Datatype" />
                        <DataGridTextColumn MinWidth="80"
                                            Binding="{Binding StartValue}"
                                            CanUserSort="False"
                                            Header="StartValue" />
                        <!--
                            <DataGridTextColumn Header="Adress" MinWidth="60"
                            Binding="{Binding Adress}"
                            CanUserSort="False"
                            IsReadOnly="True"
                            />
                        -->
                        <DataGridTextColumn Width="300"
                                            MinWidth="100"
                                            Binding="{Binding Comment}"
                                            CanUserSort="False"
                                            Header="Comment" />
                    </DataGrid.Columns>
                </DataGrid>

            </DockPanel>
            <Label Name="errors"
                   Height="30"
                   DockPanel.Dock="Bottom">
                Errors
            </Label>
            <avalonEdit:TextEditor Name="textEditor"
                                   FontFamily="Consolas"
                                   FontSize="10pt"
                                   MouseHover="textEditor_MouseHover"
                                   MouseHoverStopped="textEditor_MouseHoverStopped"
                                   ShowLineNumbers="True"
                                   Visibility="Visible" />

        </DockPanel>
    </Grid>
</Window>
